package com.sky.mapper;

import com.sky.entity.Employee;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface EmployeeMapper {

    /**
     * 根据用户名查询员工
     * @param username
     * @return
     */
    @Select("select * from employee where username = #{username}")
    Employee getByUsername(String username);

    /**
     * 根据用户Id查询密码
     * @param empId
     * @return
     */
    @Select("select password from employee where id= #{empId}")
    String getPassword(Long empId);

    /**
     * 根据id修改密码
     * @param empId
     * @param newPassword
     * @return
     */
    @Update("update employee set password=#{newPassword} where id=#{empId}")
    Integer updatePassword(Long empId, String newPassword);

}
